class FooterWalker extends Walker_Nav_Menu {
private $column_open = false;
function start_lvl(&$output, $depth = 0, $args = []) {
if ($depth === 0) {
$output .= "
\n";
}
}
function end_lvl(&$output, $depth = 0, $args = []) {
if ($depth === 0) {
$output .= "
\n";
}
}
function start_el(&$output, $item, $depth = 0, $args = [], $id = 0) {
// Start new column on top-level items
if ($depth === 0) {
if ($this->column_open) {
$output .= "\n"; // Close previous column
}
$output .= "\n"; // Close last column
$this->column_open = false;
}
return $output;
}
}